﻿#ifndef VIEWWIDGET_H
#define VIEWWIDGET_H

#include <QWidget>
#include "customgraphicsview.h"
#include "detectionresult.h"
#include "imagedetaildialog.h"
#include "seatdetectionparameter.h"

namespace Ui {
class ViewWidget;
}

class ViewWidget : public QWidget
{
    Q_OBJECT

public:
    explicit ViewWidget(QWidget *parent = nullptr, bool hasDetailDialog = false);
    ~ViewWidget();

private:
    bool                        m_hasDetailDialog;
    SeatDetectionParameter      m_seatDetectionParameter;
    DetectionResult             m_detectionResult;
    // 使用文件名的编号作为该属性的值
    int                         m_fileNumber;
    QString                     m_fileNamePath;

protected:
    virtual void mouseDoubleClickEvent(QMouseEvent *event);

public:
    void SetFileNumber(int num) { m_fileNumber = num; }

public:
    void SetPositionInfoShow(bool bShow = true);
    void SetDefectInfoShow(bool bShow = true);

    void SetDetectionResult(SeatDetectionParameter &seatDetectionParameter,
                            DetectionResult &detectionResult, bool isShow10X);
    void SetImage(QString path);
    void SetImage(QImage& image);
    bool HasDetailDialog() { return m_hasDetailDialog; }

    void ClearPosInfo(){m_viewBox->ClearPosInfo();m_viewBox->update();}
    void ClearDefectInfo(){m_viewBox->ClearDefectInfo();}

signals:
    void changeSelect(int index);

private slots:
    void HasSelected();

private:
    Ui::ViewWidget *ui;
    CustomGraphicsView *m_viewBox;
};

#endif // VIEWWIDGET_H
